﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace Kaesoft.Hospedaje.Common
{
    public static class Design
    {
        private static bool? _isInDesignMode;
        public static bool IsInDesignModeStatic
        {
            get
            {
                if (!_isInDesignMode.HasValue)
                {
                #if DEBUG
                #if SILVERLIGHT
                                    _isInDesignMode = DesignerProperties.IsInDesignTool;
                #else
                                    var prop = DesignerProperties.IsInDesignModeProperty;
                                    _isInDesignMode = (bool)DependencyPropertyDescriptor.FromProperty(prop, typeof(FrameworkElement)).Metadata.DefaultValue;
                                    if (!_isInDesignMode.Value)
                                    if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.StartsWith(@"devenv"))
                                    _isInDesignMode = true;
                #endif
                #else
                                    _isInDesignMode = false;
                #endif
                                }
                return _isInDesignMode.Value;
            }
        }

    }
}
